package com.financing.wap.web.controller.api;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.financing.wap.common.ResultMap;
import com.financing.wap.common.ResultMap.STATUS;
import com.financing.wap.dto.DiscussDTO;
import com.financing.wap.dto.FriendshipLinkDTO;
import com.financing.wap.service.IFriendshipLinkService;
import com.financing.wap.web.controller.BaseController;


@Controller
@RequestMapping("/api/friendshipLink")
public class FriendshipLinkController extends BaseController{
		
	Logger logger = Logger.getLogger(getClass());
	
	@Autowired
	IFriendshipLinkService friendshipLinkService;
	
	@RequestMapping("/list")
	@ResponseBody
	public ResultMap queryList(HttpServletRequest request,
			HttpServletResponse response,FriendshipLinkDTO friendshipLinkDTO) {
			ResultMap result = new ResultMap();
			try {
				List<FriendshipLinkDTO> list  = friendshipLinkService.queryList(friendshipLinkDTO);
				result.setStatus(STATUS.SUCCESS);
				result.setStatusCode(ResultMap.STATUS_CODE_SUCCESS);
				result.setAttribute("List", list);
			}catch(Exception e) {
				logger.warn("==>warn messang:"+e.getMessage());
				result.setStatus(STATUS.ERROR);
			}
			return result;
	}
	
}
